package cn.spring.ly.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

import org.apache.solr.client.solrj.beans.Field;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 
 * </p>
 *
 * @author ly
 * @since 2018-12-19
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class Goods extends Model<Goods> {

	private static final long serialVersionUID = 1L;

	// @Field(value="id")//与solr字段一致可以不写
	@TableId(value = "id", type = IdType.AUTO)
	private Integer id;
	
	@Field(value = "category_id")
	private Integer categoryId;

	/**
	 * 商品序列号
	 */
	private String goodsSn;

	/**
	 * 商品名称
	 */
	@Field
	private String name;

	/**
	 * 品牌id
	 */
	private Integer brandId;

	/**
	 * 商品数量
	 */
	@Field(value = "goods_number")
	private Integer goodsNumber;

	/**
	 * 简明介绍
	 */
	private String goodsBrief;

	/**
	 * 商品描述
	 */
	private String goodsDesc;

	/**
	 * 商品主图
	 */
	private String primaryPicUrl;

	/**
	 * 商品列表图
	 */
	private String listPicUrl;

	/**
	 * 是否售卖
	 */
	private Boolean isOnSale;

	/**
	 * 是否热门商品
	 */
	private Boolean isHot;

	/**
	 * 是否删除
	 */
	@TableLogic
	private Boolean isDelete;

	/**
	 * 销售量
	 */
	private Integer sellVolume;

	/**
	 * 零售价格 售价
	 */
	@Field(value = "retail_price")
	private BigDecimal retailPrice;

	/**
	 * 原价
	 */
	@Field(value = "market_price")
	private BigDecimal marketPrice;

	/**
	 * 0:非秒杀商品，1:秒杀商品
	 */
	@TableField("is_secKill")
	private Integer isSeckill;

	/**
	 * 秒杀开始时间
	 */
	private LocalDateTime startTime;

	/**
	 * 添加时间
	 */
	private LocalDateTime createTime;

	/**
	 * 创建人ID
	 */
	private Long createUserId;

	/**
	 * 修改时间
	 */
	private LocalDateTime updateTime;

	/**
	 * 修改人ID
	 */
	private Long updateUserId;

	/**
	 * 不是数据库字段
	 */
	@TableField(exist = false)
//	@Field(value = "category_parent_name") // 对应solr字段
	private String categoryParentName;

//	@Field(value = "category_name") // 对应solr字段
	@TableField(exist = false)
	private String categoryName;

	/**
	 * name分词的高亮
	 */
	@TableField(exist = false)
	private String nameHighlighting;

	public static final String ID = "id";

	public static final String CATEGORY_ID = "category_id";

	public static final String GOODS_SN = "goods_sn";

	public static final String NAME = "name";

	public static final String BRAND_ID = "brand_id";

	public static final String GOODS_NUMBER = "goods_number";

	public static final String GOODS_BRIEF = "goods_brief";

	public static final String GOODS_DESC = "goods_desc";

	public static final String PRIMARY_PIC_URL = "primary_pic_url";

	public static final String LIST_PIC_URL = "list_pic_url";

	public static final String IS_ON_SALE = "is_on_sale";

	public static final String IS_HOT = "is_hot";

	public static final String IS_DELETE = "is_delete";

	public static final String SELL_VOLUME = "sell_volume";

	public static final String RETAIL_PRICE = "retail_price";

	public static final String MARKET_PRICE = "market_price";

	public static final String IS_SECKILL = "is_secKill";

	public static final String START_TIME = "start_time";

	public static final String CREATE_TIME = "create_time";

	public static final String CREATE_USER_ID = "create_user_id";

	public static final String UPDATE_TIME = "update_time";

	public static final String UPDATE_USER_ID = "update_user_id";

	public static final String CATEGORY_PARENT_NAME = "category_parent_name";

	public static final String CATEGORY_NAME = "category_name";

	@Override
	protected Serializable pkVal() {
		return this.id;
	}

}
